

public class Car {
    private String color;
    private String brand;
    private double price;

    public void setColor(String color){
        this.color=color;
    }
    public void setBrand(String brand){
        this.brand=brand;
    }
    public void setPrice(double price){
        this.price=price;
    }
    public String getColor(){
        return color;
    }
    public String getBrand(){
        return brand;
    }
    public double getPrice(){
        return price;
    } 
    
    //无参构造器
    public Car(){
        
    }
    //全参构造器
    public Car(String color,String brand,double price){
        this.color=color;
        this.brand=brand;
        this.price=price;
    }

    //方法
    public void goAhead(){
        System.out.println("前进");
    }
    public void backward(){
        System.out.println("后退");
    }
    public void turnleft(){
        System.out.println("汽车左转");
    }
    public void turnright(){
        System.out.println("汽车右转");
    }
    public void stop(){
        System.out.println("汽车制动");
    }
    public void show(){
        System.out.println("颜色："+color+"  品牌: "+brand+"  价格："+price);
    }
   
}
